Imports IIC.Forms.Edit
Imports CrystalReportViewer

Namespace Forms.List
    Public Class frmMemberList
        Inherits frmStudentList

        Overrides Sub LoadDataToGrid()

            CType(Me.grdData, Grid.CGSQLGrid).gpWhereclause = "isMember=1 "
            Me.grdData.loadGrid()
            Me.Text = "Member List"
            Me.grdData.Columns("IsMember").Visible = False
            Dim ismemberCol As DataGridViewAutoFilterCheckBoxColumn = _
                    CType(Me.grdData.Columns("IsMemberActive"), DataGridViewAutoFilterCheckBoxColumn)

            Call ismemberCol.selectFilteredItem("1")
            'CType(Me.Owner, frmMain).RefreshNumberOfRecordsLabel()

        End Sub


        Public Overrides Function PrepareEditForm(ByVal IdValue As Integer, _
                                                  ByVal editForm As frmBaseEdit) As Boolean

            If MyBase.PrepareEditForm(IdValue, editForm) Then
                Dim ucm As ucStudentMembershipDetails = CType(editForm, frmStudentDetails).UcStudent.UcStudentMembershipDetails
               
                If IdValue = 0 Then

                    ucm.IsMember.Checked = True
                    ucm.IsMemberActive.Checked = True

                    ucm.MemberNumber.value = DBUtils.Current.getIntValue( _
                                    "SELECT MAX(MemberNumber) + 1 AS nextMemberNo FROM Student WHERE MemberNumber IS NOT NULL")
                    ucm.MemberNumber.ForeColor = Color.DarkRed
                End If

                Return True

            Else
                Return False
            End If

        End Function
    End Class

End Namespace
